#include "gtksizerequest.h"
#include "gtkwidgetprivate.h"
#include "gtkcontainerprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkprivate.h"
GList *children;
GList *row_properties;
- GtkCssGadget *gadget;
-
GtkOrientation orientation;
gint baseline_row;
g_list_free_full (priv->row_properties, (GDestroyNotify)gtk_grid_row_properties_free);
- g_clear_object (&priv->gadget);
-
G_OBJECT_CLASS (gtk_grid_parent_class)->finalize (object);
}
}
static void
-gtk_grid_measure_ (GtkWidget *widget,
+gtk_grid_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *minimum_baseline,
int *natural_baseline)
{
- gtk_css_gadget_get_preferred_size (GTK_GRID (widget)->priv->gadget,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
-}
-
-static void
-gtk_grid_measure (GtkCssGadget *gadget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline,
- gpointer data)
-{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkGrid *grid = GTK_GRID (widget);
if ((orientation == GTK_ORIENTATION_HORIZONTAL &&
gtk_grid_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- GtkAllocation clip;
-
- gtk_widget_set_allocation (widget, allocation);
-
- gtk_css_gadget_allocate (GTK_GRID (widget)->priv->gadget,
- allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
-
- gtk_widget_set_clip (widget, &clip);
-}
-
-static void
-gtk_grid_allocate (GtkCssGadget *gadget,
- const GtkAllocation *allocation,
- int baseline,
- GtkAllocation *out_clip,
- gpointer data)
-{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
+ GtkAllocation clip = *allocation;
+ GtkAllocation children_clip;
GtkGrid *grid = GTK_GRID (widget);
GtkGridPrivate *priv = grid->priv;
GtkGridRequest request;
GtkOrientation orientation;
if (priv->children == NULL)
- return;
+ {
+ gtk_widget_set_clip (widget, &clip);
+ return;
+ }
request.grid = grid;
gtk_grid_request_position (&request, 0);
gtk_grid_request_position (&request, 1);
- *out_clip = *allocation;
- gtk_grid_request_allocate_children (&request, allocation, out_clip);
+ gtk_grid_request_allocate_children (&request, allocation, &children_clip);
+ gdk_rectangle_union (&children_clip, &clip, &clip);
+
+ gtk_widget_set_clip (widget, &clip);
}
static void
object_class->finalize = gtk_grid_finalize;
widget_class->size_allocate = gtk_grid_size_allocate;
- widget_class->measure = gtk_grid_measure_;
+ widget_class->measure = gtk_grid_measure;
container_class->add = gtk_grid_add;
container_class->remove = gtk_grid_remove;
priv->linedata[0].homogeneous = FALSE;
priv->linedata[1].homogeneous = FALSE;
- priv->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (grid)),
- GTK_WIDGET (grid),
- gtk_grid_measure,
- gtk_grid_allocate,
- NULL,
- NULL,
- NULL);
-
-
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (grid));
}